class Solution {
public:
    int getDis(vector<int>& A, int n) {
        int MinNum = A[0], ret = 0;
        for (int i = 0; i < n; i++)
        {
            MinNum = min(MinNum, A[i]);
            int t = A[i] - MinNum;
            ret = max(ret, t);
        }

        return ret;
    }
};
